/**
 * 
 */
package mdb.com.vn.web.view;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import mdb.com.vn.model.FixedDepositCasa;

/**
 * @author tu.dod
 * 
 */
public class FDCSDataModel extends ListDataModel<FixedDepositCasa> implements
		SelectableDataModel<FixedDepositCasa>,Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public FDCSDataModel() {
		// TODO Auto-generated constructor stub
	}
	public FDCSDataModel(List<FixedDepositCasa> fixedDepositCasas) {
		// TODO Auto-generated constructor stub
		super(fixedDepositCasas);
	}

	@SuppressWarnings("unchecked")
	@Override
	public FixedDepositCasa getRowData(String rowKey) {
		// TODO Auto-generated method stub
		List<FixedDepositCasa> fixedDepositCasas = (List<FixedDepositCasa>) getWrappedData();
		for (FixedDepositCasa fixedDepositCasa : fixedDepositCasas) {
			if(fixedDepositCasa.getSavingbookNo().equals(rowKey)){
				return fixedDepositCasa;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(FixedDepositCasa fixedDepositCasa) {
		// TODO Auto-generated method stub
		return fixedDepositCasa.getSavingbookNo();
	}

}
